<template>
  <view class="loginwait">
	  
  </view>
</template>

<script>
  import { loginByTicket } from '@/api/login'
  import { getToken, setToken, removeToken } from '@/utils/auth'
  export default {
    data() {
      return {
        isApp: this.$store.state.user.isApp,
		ticket: this.$store.state.user.ticket,
		res: null,
      }
    },
    created() {
      this.login()
	},
    methods: {
      login(){
		let data = {
			"isApp": this.isApp,
			"ticket": this.ticket
		}
		// console.log("loginByTicket data",data)
        loginByTicket(data).then(res => {
			setToken(res.token)
            this.loginSuccess()
        })
      },
	  // 登录成功后，处理函数
	  loginSuccess() {
	    // 设置用户信息
	    this.$store.dispatch('GetInfo').then(res => {
        let arr = this.$store.state.user.baseUrl.split(':')
        let burl = arr[0]+':'+arr[1]
        window.location.href = window.location.origin + window.location.pathname
	    })
	  }
    }
  }
</script>

<style lang="scss">
  page {
    background-color: #ffffff;
  }

  .loginwait{
	  display: grid;
	  justify-content: center;
	  align-items: center;
  }
</style>
